Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add versioned and backwards-compatible server version to block proposal #5803

Merged
merged 6 commits into from
Feb 10, 2025

Conversation

hstove
Copy link
Contributor

@hstove hstove commented Feb 4, 2025

This PR introduces a pattern that we introduced previously to BlockResponse, which allows us to add new fields to the BlockProposal struct without worrying about backwards/forwards issues with serialization.

Critically, this PR only works because there is no place where we deserialize a Vec<BlockProposal> (just like we didn't/don't deserialize Vec<BlockResponse>). The only time we do anything like that is when deserializing StackerDB chunks, but the fact that StackerDbChunk "wraps" these structs is what makes this OK.

The reason we need to add this pattern is because Vec-based deserialization will run into issues, because "old" versions of the code won't fully consume each item's bytes.

This new pattern does consume all of the item's bytes, even if the item was serialized using future code.

@hstove hstove requested review from a team as code owners February 4, 2025 23:02
@hstove hstove linked an issue Feb 4, 2025 that may be closed by this pull request
@hstove hstove requested review from kantai and jferrant February 4, 2025 23:02
kantai
kantai previously approved these changes Feb 5, 2025
Copy link
Contributor

@obycode obycode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just two minor comments.

libsigner/src/events.rs Outdated Show resolved Hide resolved
libsigner/src/events.rs Outdated Show resolved Hide resolved
@hstove hstove requested a review from a team as a code owner February 6, 2025 15:24
@hstove hstove requested review from obycode and kantai February 6, 2025 15:24
CHANGELOG.md Outdated Show resolved Hide resolved
@hstove hstove requested a review from obycode February 6, 2025 20:33
obycode
obycode previously approved these changes Feb 6, 2025
jferrant
jferrant previously approved these changes Feb 7, 2025
Copy link
Collaborator

@jferrant jferrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice!

@hstove hstove dismissed stale reviews from jferrant and obycode via 5a76b47 February 7, 2025 21:02
@hstove
Copy link
Contributor Author

hstove commented Feb 7, 2025

Changelog conflict fixed, requesting re-approvals :)

@hstove hstove requested review from jferrant and obycode February 7, 2025 21:02
@jferrant jferrant added this pull request to the merge queue Feb 10, 2025
Merged via the queue into develop with commit d39ff29 Feb 10, 2025
175 of 177 checks passed
@jferrant jferrant deleted the feat/add-version-to-block-proposal branch February 10, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add server version string to block proposal metadata
4 participants